<?php

namespace App\Models;

use Barryvdh\LaravelIdeHelper\Eloquent;
use Illuminate\Database\Eloquent\Model;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Foundation\Auth\User as Authenticatable;




/**
 * App\Models\AppUser
 *
 * @property string $id
 * @property string $name 用户名
 * @property string $password 密码
 * @property string $open_id 微信openId
 * @property string|null $phone_number 手机号
 * @property string|null $avatar 头像
 * @property string|null $id_card_no 身份证号
 * @property int $gender 性别:0女,1男,2未知
 * @property int $point 会员积分
 * @property string|null $country 国家
 * @property string|null $city 城市
 * @property string|null $language 语言
 * @property string|null $nick_name 昵称
 * @property string|null $passport 护照
 * @property string|null $birthday 生日
 * @property string|null $area 地区
 * @property string|null $company 公司名称
 * @property string|null $worker_address 工作地址
 * @property string|null $worker_time 入职时间
 * @property string|null $worker_level 职位职级
 * @property string|null $income 收入区间
 * @property string|null $house 房产信息
 * @property string|null $car_a 车辆行驶证主页
 * @property string|null $car_b 车辆行驶证副页
 * @property string|null $id_card_a 身份证正面
 * @property string|null $id_card_b 身份证反面
 * @property string|null $school 学校
 * @property mixed|null $location 地理位置
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser query()
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereArea($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereAvatar($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereBirthday($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereCarA($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereCarB($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereCity($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereCompany($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereCountry($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereGender($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereHouse($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereIdCardA($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereIdCardB($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereIdCardNo($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereIncome($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereLanguage($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereLocation($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereNickName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereOpenId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser wherePassport($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser wherePassword($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser wherePhoneNumber($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser wherePoint($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereSchool($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereWorkerAddress($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereWorkerLevel($value)
 * @method static \Illuminate\Database\Eloquent\Builder|AppUser whereWorkerTime($value)
 * @mixin \Eloquent
 */
class AppUser extends Authenticatable implements JWTSubject
{
    protected $table = 'app_user';
    protected $primaryKey = 'id';
    public $incrementing = false;

    protected static function boot()
    {
        parent::boot();
        static::creating(function (Model $model) {
            $key = $model->getKeyName();
            if (empty($model->{$key})) {
                $model->{$key} = generateNewUuid();
            }
        });
    }

    /**
     * Get the identifier that will be stored in the subject claim of the JWT.
     *
     * @return mixed
     */
    public function getJWTIdentifier()
    {
        return $this->getKey();
    }

    /**
     * Return a key value array, containing any custom claims to be added to the JWT.
     *
     * @return array
     */
    public function getJWTCustomClaims()
    {
        return [];
    }
}
